//密封
sealed class LicenseStatus3 {

    object UnQualified : LicenseStatus3()
    object Learning : LicenseStatus3()
    class Qualified(val licenseId: String) : LicenseStatus3()

}

class Driver3(var status: LicenseStatus3) {
    fun checkLicense(): String {
        return when(status){
            is LicenseStatus3.UnQualified -> "没资格"
            is LicenseStatus3.Learning -> "在学"
            is LicenseStatus3.Qualified -> "有资格，驾驶证编号：${(this.status as LicenseStatus3.Qualified).licenseId}"
        }
    }
}

fun main() {
    val status = LicenseStatus3.Qualified("238239329")
    val driver = Driver3(status)
    println(driver.checkLicense())
}